"Auto-commit via make git"
Some checks failed
Build NFDOS ISO / build (push) Has been cancelled

This commit is contained in:
neo.webmaster.2@gmail.com 2025-12-03 15:40:18 +01:00
parent 71130ec056
commit 5b837e0112
11 changed files with 1903 additions and 194 deletions

View File

@ -7,174 +7,610 @@ cat -A Makefile.am | grep '\^I'
cat -A src/Makefile.am | grep '\^I'
cat -A configure.ac | grep '\^I'
nl -ba Makefile | sed -n '770,790p'
grep -n "^[ ]" Makefile | head
grep -n "^[ ]" Makefile | head
ate que esta a ficar bonito 😍:
grep -E 'X86_PGE|X86_PSE|X86_PSE36|X86_VME|X86_PVI|SMAP|SMEP|RANDOMIZE_BASE|PAGE_TABLE_ISOLATION' src/_nfdos/kernel/linux/.config
grep -E '^CONFIG_CR4' src/_nfdos/kernel/linux/.config || true
┌────────────────────────────────────────────────────────────────────────────┐
│ NEUROTRON STATUS CPU: 2% MEM: 11% TEMP: 1.2 ENERGY: 41.0 │
│ CogState: STABLE Depth: 1 Valence: -5.00 Mode: ACTIVE │
├────────────────────────────────────────────────────────────────────────────┤
│ KERNEL MESSAGES (live): │
│ [ 0.167890] ACPI: Core revision 20240415 │
│ [ 0.260302] pci 0000:00:02.0: VESA 1024x768x32 framebuffer activated │
│ [ 1.012399] EXT4-fs mounted filesystem with ordered data mode. │
│ ... │
├────────────────────────────────────────────────────────────────────────────┤
│ NEUROTRON TRM: │
│ mem estável — tendência favorável │
│ sistema frio — margem para explorar │
│ valência baixa — evitar exploração │
├────────────────────────────────────────────────────────────────────────────┤
│ NEUROTRON CHAT: │
│ [ia@nfdos] Olá mundo! │
│ [user@nfdos] ... │
├────────────────────────────────────────────────────────────────────────────┤
│ user@nfdos: │
└────────────────────────────────────────────────────────────────────────────┘
Quando quiseres damos o próximo passo: Ritmos Internos — osciladores cognitivos leves (senoides, modulação lenta, ciclos internos).
São eles que vão permitir padrões emergentes mais profundos.
grep ok:
```
UP: 00:01:14 TICK: 0.50s MODO: PERSISTENT
grep -R "NFDOS_CR4_SAFE_MASK" -n src/_nfdos/kernel/linux/arch/x86/mm
src/_nfdos/kernel/linux/arch/x86/mm/init.c:39:#define NFDOS_CR4_SAFE_MASK \
src/_nfdos/kernel/linux/arch/x86/mm/init.c:252: mask &= NFDOS_CR4_SAFE_MASK;
```
sequencia da compil tambem ok:
```
Compilando Kernel Linux...
make mrproper
CLEAN arch/x86/entry/vdso
CLEAN arch/x86/kernel/cpu
CLEAN arch/x86/kernel
CLEAN arch/x86/realmode/rm
CLEAN arch/x86/tools
CLEAN init
CLEAN usr
CLEAN .
CLEAN scripts/basic
CLEAN scripts/kconfig
CLEAN scripts/mod
CLEAN scripts
CLEAN include/config include/generated arch/x86/include/generated .config .config.old
make allnoconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
→ Patching kernel headers for C23 compatibility...
make prepare
SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
SYSTBL arch/x86/include/generated/asm/syscalls_32.h
SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/include/generated/asm/syscalls_64.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
HOSTCC scripts/kallsyms
HOSTCC scripts/sorttable
WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/x86/include/generated/uapi/asm/errno.h
WRAP arch/x86/include/generated/uapi/asm/fcntl.h
WRAP arch/x86/include/generated/uapi/asm/ioctl.h
WRAP arch/x86/include/generated/uapi/asm/ioctls.h
WRAP arch/x86/include/generated/uapi/asm/ipcbuf.h
WRAP arch/x86/include/generated/uapi/asm/param.h
WRAP arch/x86/include/generated/uapi/asm/poll.h
WRAP arch/x86/include/generated/uapi/asm/resource.h
WRAP arch/x86/include/generated/uapi/asm/socket.h
WRAP arch/x86/include/generated/uapi/asm/sockios.h
WRAP arch/x86/include/generated/uapi/asm/termbits.h
WRAP arch/x86/include/generated/uapi/asm/termios.h
WRAP arch/x86/include/generated/uapi/asm/types.h
WRAP arch/x86/include/generated/asm/early_ioremap.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
WRAP arch/x86/include/generated/asm/mmzone.h
WRAP arch/x86/include/generated/asm/irq_regs.h
WRAP arch/x86/include/generated/asm/kmap_size.h
WRAP arch/x86/include/generated/asm/local64.h
WRAP arch/x86/include/generated/asm/mmiowb.h
WRAP arch/x86/include/generated/asm/module.lds.h
WRAP arch/x86/include/generated/asm/rwonce.h
GEN arch/x86/include/generated/asm/orc_hash.h
UPD include/config/kernel.release
UPD include/generated/uapi/linux/version.h
UPD include/generated/utsrelease.h
UPD include/generated/compile.h
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/modpost.o
CC scripts/mod/devicetable-offsets.s
UPD scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/sumversion.o
HOSTCC scripts/mod/symsearch.o
HOSTLD scripts/mod/modpost
UPD include/generated/timeconst.h
CC kernel/bounds.s
UPD include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHKSHA1 include/linux/atomic/atomic-arch-fallback.h
CHKSHA1 include/linux/atomic/atomic-instrumented.h
CHKSHA1 include/linux/atomic/atomic-long.h
DESCEND objtool
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/exec-cmd.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/help.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/pager.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/parse-options.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/run-command.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/sigchain.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/subcmd-config.o
LD /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/libsubcmd-in.o
AR /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libsubcmd/libsubcmd.a
INSTALL libsubcmd_headers
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/arch/x86/special.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/arch/x86/decode.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/arch/x86/orc.o
LD /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/arch/x86/objtool-in.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/weak.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/check.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/special.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/builtin-check.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/elf.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/objtool.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/orc_gen.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/orc_dump.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libstring.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/libctype.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/str_error_r.o
CC /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/librbtree.o
LD /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/objtool-in.o
LINK /home/neo/Público/nfdos/src/_nfdos/kernel/linux/tools/objtool/objtool
make scripts
✔ Patched: include/linux/stddef.h
✔ Patched: include/linux/types.h
→ Boot directory forced to GNU11: arch/x86/boot
→ Boot directory forced to GNU11: arch/x86/boot/compressed
→ Boot directory forced to GNU11: drivers/firmware/efi/libstub
→ Global C23 overrides neutralized in main Makefile
✔ Kernel headers & boot toolchain fully sanitized.
git checkout -- arch/x86/mm/init.c
cp /home/neo/Público/nfdos/src/_nfdos/init.c /home/neo/Público/nfdos/src/_nfdos/kernel/linux/arch/x86/mm/init.c
→ Aplicando overrides de configuração...
scripts/config --enable CONFIG_PRINTK
[...]
scripts/config --enable CONFIG_BINFMT_SCRIPT
make olddefconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
✔ Overrides aplicados com sucesso.
make olddefconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
#
# No change to .config
#
make -j 4
SYNC include/config/auto.conf.cmd
[...]
Kernel: arch/x86/boot/bzImage is ready (#1)
✔ Kernel compilado com sucesso!
```
qemu standard ok:
```
# 🧠 Monta a linha base do QEMU
kernel_params = (
"console=ttyS0 earlyprintk=serial,ttyS0,115200 "
"keep_bootcon loglevel=8"
)
qemu_cmd = (
f"qemu-system-x86_64 "
f"-machine q35,accel=kvm " # q35,accel=kvm
f"-cpu qemu64 " # qemu64
f"-kernel {bz_image} "
f"-initrd {nfdos_dir}/initramfs.cpio.gz "
f"-append '{kernel_params}' "
f"-drive file={data_disk},if=virtio,format=raw "
f"-m 1024 "
# f"-vga std "
# f"-display default "
# f"-serial mon:stdio "
f"-nographic "
f"-no-reboot"
)
```
e temos o neurotron a falar conosco:
```
Linux version 6.12.0-nfdos (neo@notebook) (x86_64-nfdos-linux-musl-gcc (crosstool-NG 1.28.0.1_403899e) 15.2.0, GNU ld (crosstool-NG 1.28.0.1_403899e) 2.45) #1 Wed Dec 3 15:21:12 CET 2025
Command line: console=ttyS0 earlyprintk=serial,ttyS0,115200 keep_bootcon loglevel=8
BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
BIOS-e820: [mem 0x0000000000100000-0x000000003ffdbfff] usable
BIOS-e820: [mem 0x000000003ffdc000-0x000000003fffffff] reserved
BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff] reserved
BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
printk: legacy bootconsole [earlyser0] enabled
printk: debug: skip boot console de-registration.
NX (Execute Disable) protection: active
APIC: Static calls initialized
SMBIOS 3.0.0 present.
DMI: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
DMI: Memory slots populated: 1/1
tsc: Fast TSC calibration failed
e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
e820: remove [mem 0x000a0000-0x000fffff] usable
last_pfn = 0x3ffdc max_arch_pfn = 0x400000000
MTRR map: 4 entries (3 fixed + 1 variable; max 19), built from 8 variable MTRRs
x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
found SMP MP-table at [mem 0x000f5470-0x000f547f]
RAMDISK: [mem 0x3e831000-0x3ffcffff]
Intel MultiProcessor Specification v1.4
MPTABLE: OEM ID: BOCHSCPU
MPTABLE: Product ID: 0.1
MPTABLE: APIC at: 0xFEE00000
Zone ranges:
DMA [mem 0x0000000000001000-0x0000000000ffffff]
DMA32 [mem 0x0000000001000000-0x000000003ffdbfff]
Normal empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000001000-0x000000000009efff]
node 0: [mem 0x0000000000100000-0x000000003ffdbfff]
Initmem setup node 0 [mem 0x0000000000001000-0x000000003ffdbfff]
On node 0, zone DMA: 1 pages in unavailable ranges
On node 0, zone DMA: 97 pages in unavailable ranges
On node 0, zone DMA32: 36 pages in unavailable ranges
Intel MultiProcessor Specification v1.4
MPTABLE: OEM ID: BOCHSCPU
MPTABLE: Product ID: 0.1
MPTABLE: APIC at: 0xFEE00000
Processor #0 (Bootup-CPU)
IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
Processors: 1
CPU topo: Max. logical packages: 1
CPU topo: Max. logical dies: 1
CPU topo: Max. dies per package: 1
CPU topo: Max. threads per core: 1
CPU topo: Num. cores per package: 1
CPU topo: Num. threads per package: 1
CPU topo: Allowing 1 present CPUs plus 0 hotplug CPUs
[mem 0x40000000-0xafffffff] available for PCI devices
clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Kernel command line: console=ttyS0 earlyprintk=serial,ttyS0,115200 keep_bootcon loglevel=8
Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
Built 1 zonelists, mobility grouping on. Total pages: 262010
mem auto-init: stack:all(zero), heap alloc:off, heap free:off
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS: 4352, nr_irqs: 48, preallocated irqs: 16
Console: colour VGA+ 80x25
printk: legacy console [ttyS0] enabled
printk: legacy console [ttyS0] enabled
APIC: Switch to symmetric I/O mode setup
APIC: Switch to symmetric I/O mode setup
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
tsc: Unable to calibrate against PIT
tsc: Unable to calibrate against PIT
tsc: No reference (HPET/PMTIMER) available
tsc: No reference (HPET/PMTIMER) available
tsc: Marking TSC unstable due to could not calculate TSC khz
tsc: Marking TSC unstable due to could not calculate TSC khz
Calibrating delay loop... 6239.23 BogoMIPS (lpj=12478464)
Calibrating delay loop... 6239.23 BogoMIPS (lpj=12478464)
Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
CPU: Intel QEMU Virtual CPU version 2.5+ (family: 0xf, model: 0x6b, stepping: 0x1)
CPU: Intel QEMU Virtual CPU version 2.5+ (family: 0xf, model: 0x6b, stepping: 0x1)
Speculative Store Bypass: Vulnerable
Speculative Store Bypass: Vulnerable
x86/fpu: x87 FPU will use FXSAVE
x86/fpu: x87 FPU will use FXSAVE
pid_max: default: 32768 minimum: 301
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
Performance Events: unsupported Netburst CPU model 107 no PMU driver, software events only.
Performance Events: unsupported Netburst CPU model 107 no PMU driver, software events only.
signal: max sigframe size: 1040
signal: max sigframe size: 1040
Memory: 990500K/1048040K available (6144K kernel code, 877K rwdata, 872K rodata, 624K init, 1324K bss, 55160K reserved, 0K cma-reserved)
Memory: 990500K/1048040K available (6144K kernel code, 877K rwdata, 872K rodata, 624K init, 1324K bss, 55160K reserved, 0K cma-reserved)
devtmpfs: initialized
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
futex hash table entries: 256 (order: 0, 6144 bytes, linear)
futex hash table entries: 256 (order: 0, 6144 bytes, linear)
PCI: Using configuration type 1 for base access
PCI: Using configuration type 1 for base access
PCI: Probing PCI hardware
PCI: Probing PCI hardware
PCI: root bus 00: using default resources
PCI: root bus 00: using default resources
PCI: Probing PCI hardware (bus 00)
PCI: Probing PCI hardware (bus 00)
PCI host bridge to bus 0000:00
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffffff]
pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffffff]
pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
pci 0000:00:00.0: [8086:29c0] type 00 class 0x060000 conventional PCI endpoint
pci 0000:00:00.0: [8086:29c0] type 00 class 0x060000 conventional PCI endpoint
pci 0000:00:01.0: [1234:1111] type 00 class 0x030000 conventional PCI endpoint
pci 0000:00:01.0: [1234:1111] type 00 class 0x030000 conventional PCI endpoint
pci 0000:00:01.0: BAR 0 [mem 0xfd000000-0xfdffffff pref]
pci 0000:00:01.0: BAR 0 [mem 0xfd000000-0xfdffffff pref]
pci 0000:00:01.0: BAR 2 [mem 0xfebd4000-0xfebd4fff]
pci 0000:00:01.0: BAR 2 [mem 0xfebd4000-0xfebd4fff]
pci 0000:00:01.0: ROM [mem 0xfebc0000-0xfebcffff pref]
pci 0000:00:01.0: ROM [mem 0xfebc0000-0xfebcffff pref]
pci 0000:00:01.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
pci 0000:00:01.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
pci 0000:00:02.0: [8086:10d3] type 00 class 0x020000 PCIe Root Complex Integrated Endpoint
pci 0000:00:02.0: [8086:10d3] type 00 class 0x020000 PCIe Root Complex Integrated Endpoint
pci 0000:00:02.0: BAR 0 [mem 0xfeb80000-0xfeb9ffff]
pci 0000:00:02.0: BAR 0 [mem 0xfeb80000-0xfeb9ffff]
pci 0000:00:02.0: BAR 1 [mem 0xfeba0000-0xfebbffff]
pci 0000:00:02.0: BAR 1 [mem 0xfeba0000-0xfebbffff]
pci 0000:00:02.0: BAR 2 [io 0xc0c0-0xc0df]
pci 0000:00:02.0: BAR 2 [io 0xc0c0-0xc0df]
pci 0000:00:02.0: BAR 3 [mem 0xfebd0000-0xfebd3fff]
pci 0000:00:02.0: BAR 3 [mem 0xfebd0000-0xfebd3fff]
pci 0000:00:02.0: ROM [mem 0xfeb00000-0xfeb7ffff pref]
pci 0000:00:02.0: ROM [mem 0xfeb00000-0xfeb7ffff pref]
pci 0000:00:03.0: [1af4:1001] type 00 class 0x010000 conventional PCI endpoint
pci 0000:00:03.0: [1af4:1001] type 00 class 0x010000 conventional PCI endpoint
pci 0000:00:03.0: BAR 0 [io 0xc000-0xc07f]
pci 0000:00:03.0: BAR 0 [io 0xc000-0xc07f]
pci 0000:00:03.0: BAR 1 [mem 0xfebd5000-0xfebd5fff]
pci 0000:00:03.0: BAR 1 [mem 0xfebd5000-0xfebd5fff]
pci 0000:00:03.0: BAR 4 [mem 0xfe000000-0xfe003fff 64bit pref]
pci 0000:00:03.0: BAR 4 [mem 0xfe000000-0xfe003fff 64bit pref]
pci 0000:00:1f.0: [8086:2918] type 00 class 0x060100 conventional PCI endpoint
pci 0000:00:1f.0: [8086:2918] type 00 class 0x060100 conventional PCI endpoint
pci 0000:00:1f.0: quirk: [io 0x0600-0x067f] claimed by ICH6 ACPI/GPIO/TCO
pci 0000:00:1f.0: quirk: [io 0x0600-0x067f] claimed by ICH6 ACPI/GPIO/TCO
pci 0000:00:1f.2: [8086:2922] type 00 class 0x010601 conventional PCI endpoint
pci 0000:00:1f.2: [8086:2922] type 00 class 0x010601 conventional PCI endpoint
pci 0000:00:1f.2: BAR 4 [io 0xc0e0-0xc0ff]
pci 0000:00:1f.2: BAR 4 [io 0xc0e0-0xc0ff]
pci 0000:00:1f.2: BAR 5 [mem 0xfebd6000-0xfebd6fff]
pci 0000:00:1f.2: BAR 5 [mem 0xfebd6000-0xfebd6fff]
pci 0000:00:1f.3: [8086:2930] type 00 class 0x0c0500 conventional PCI endpoint
pci 0000:00:1f.3: [8086:2930] type 00 class 0x0c0500 conventional PCI endpoint
pci 0000:00:1f.3: BAR 4 [io 0x0700-0x073f]
pci 0000:00:1f.3: BAR 4 [io 0x0700-0x073f]
pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
pci 0000:00:01.0: PIIX/ICH IRQ router [1234:1111]
pci 0000:00:01.0: PIIX/ICH IRQ router [1234:1111]
PCI: pci_cache_line_size set to 64 bytes
PCI: pci_cache_line_size set to 64 bytes
e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
e820: reserve RAM buffer [mem 0x3ffdc000-0x3fffffff]
e820: reserve RAM buffer [mem 0x3ffdc000-0x3fffffff]
pci 0000:00:01.0: vgaarb: setting as boot VGA device
pci 0000:00:01.0: vgaarb: setting as boot VGA device
pci 0000:00:01.0: vgaarb: bridge control possible
pci 0000:00:01.0: vgaarb: bridge control possible
pci 0000:00:01.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
pci 0000:00:01.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
vgaarb: loaded
vgaarb: loaded
clocksource: Switched to clocksource refined-jiffies
clocksource: Switched to clocksource refined-jiffies
pci_bus 0000:00: resource 4 [io 0x0000-0xffff]
pci_bus 0000:00: resource 4 [io 0x0000-0xffff]
pci_bus 0000:00: resource 5 [mem 0x00000000-0xffffffffff]
pci_bus 0000:00: resource 5 [mem 0x00000000-0xffffffffff]
PCI: CLS 0 bytes, default 64
PCI: CLS 0 bytes, default 64
platform rtc_cmos: registered platform RTC device (no PNP device found)
platform rtc_cmos: registered platform RTC device (no PNP device found)
Unpacking initramfs...
Unpacking initramfs...
workingset: timestamp_bits=62 max_order=18 bucket_order=0
workingset: timestamp_bits=62 max_order=18 bucket_order=0
virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 11
virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 11
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
virtio_blk virtio0: 1/0/0 default/read/poll queues
virtio_blk virtio0: 1/0/0 default/read/poll queues
virtio_blk virtio0: [vda] 1048576 512-byte logical blocks (537 MB/512 MiB)
virtio_blk virtio0: [vda] 1048576 512-byte logical blocks (537 MB/512 MiB)
Freeing initrd memory: 24188K
Freeing initrd memory: 24188K
Freeing unused kernel image (initmem) memory: 624K
Freeing unused kernel image (initmem) memory: 624K
Write protecting the kernel read-only data: 8192k
Write protecting the kernel read-only data: 8192k
Freeing unused kernel image (rodata/data gap) memory: 1176K
Freeing unused kernel image (rodata/data gap) memory: 1176K
Run /init as init process
Run /init as init process
with arguments:
with arguments:
/init
/init
with environment:
with environment:
HOME=/
HOME=/
TERM=linux
TERM=linux
random: crng init done
UP: 00:00:18 TICK: 0.62s MODO: DIAGNOSTIC
────────────────────────────────────────────────────────────────────────────────
[06:23:38] [debug] [diag] estado=STABLE cpu=0.0 mem=10.6 load1=0.44
[06:23:38] [diag] estado=STABLE cpu=0.0 mem=10.6 load1=0.44
[06:23:38] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.44 jitter=0.904s
[06:23:38] [debug] [trm.thought] mem estável — tendência favorável
[06:23:38] [debug] [trm.thought] sistema frio — margem para explorar
[06:23:38] [debug] [trm.thought] valência baixa — evitar exploração
[06:23:38] [debug] [trm.engine] step ok: mode=active cog=stable energy=43.1 depth=1 valence=-5.00
[06:23:38] [heart] cpu=0.0% mem=10.6% tick=0.50s
[06:23:39] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.44 jitter=0.748s
[06:23:39] [debug] [trm.thought] mem estável — tendência favorável
[06:23:39] [debug] [trm.thought] sistema frio — margem para explorar
[06:23:39] [debug] [trm.thought] valência baixa — evitar exploração
[06:23:39] [debug] [trm.engine] step ok: mode=active cog=stable energy=42.4 depth=1 valence=-5.00
[06:23:39] [heart] cpu=0.0% mem=10.6% tick=0.50s
[06:23:39] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.44 jitter=0.784s
[06:23:40] [debug] [trm.thought] mem estável — tendência favorável
[06:23:40] [debug] [trm.thought] sistema frio — margem para explorar
[06:23:40] [debug] [trm.thought] valência baixa — evitar exploração
[06:23:40] [debug] [trm.engine] step ok: mode=active cog=stable energy=41.7 depth=1 valence=-5.00
[06:23:40] [heart] cpu=0.0% mem=10.6% tick=0.50s
[06:23:40] [debug] Vitals CPU=0.0% MEM=10.6% load1=0.4
[06:23:40] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.40 jitter=0.820s
[06:23:40] [debug] [trm.thought] mem estável — tendência favorável
[06:23:40] [debug] [trm.thought] sistema frio — margem para explorar
[06:23:40] [debug] [trm.thought] valência baixa — evitar exploração
[06:23:40] [debug] [trm.engine] step ok: mode=active cog=stable energy=41.0 depth=1 valence=-5.00
[06:23:40] [heart] cpu=0.0% mem=10.6% tick=0.50s
[06:23:41] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.40 jitter=0.736s
[06:23:41] [debug] [trm.thought] mem estável — tendência favorável
[06:23:41] [debug] [trm.thought] sistema frio — margem para explorar
[06:23:41] [debug] [trm.thought] valência baixa — evitar exploração
[06:23:41] [debug] [trm.engine] step ok: mode=active cog=stable energy=40.3 depth=1 valence=-5.00
[06:23:41] [heart] cpu=0.0% mem=10.6% tick=0.50s
[06:23:42] [debug] [diag] estado=STABLE cpu=0.0 mem=10.6 load1=0.4
[06:23:42] [diag] estado=STABLE cpu=0.0 mem=10.6 load1=0.4
[06:23:42] [debug] telemetry state=stable temp=1.2 cpu=0.0% mem=10.6% load=0.40
[14:23:22] [info] tick ajustado 0.88s → 0.75s
[14:23:22] [debug] telemetry state=stable temp=0.7 cpu=0.0% mem=10.4% load=0.00 jitter=1.324s
[14:23:22] [debug] [trm.archaeologist] encontrou 3 eventos perigosos recentes → valence -0.30
[14:23:22] [debug] [trm.thought] mem estável — tendência favorável
[14:23:22] [debug] [trm.thought] sistema frio — margem para explorar
[14:23:22] [debug] [trm.engine] step ok: mode=active cog=stable energy=92.1 depth=1 valence=-2.70
[14:23:22] [heart] cpu=0.0% mem=10.4% tick=0.75s
[14:23:23] [disk] Filesystem existente detectado
[14:23:23] [debug] Vitals CPU=0.0% MEM=10.5% load1=0.0
[14:23:23] [info] [echo] CPU=0.0% MEM=10.5%
```
podemos adicionar "o pensador" ao roadmap:
agora a parte do "como fiz?": fui no gitea buscar o ".config" que funcionava:
```
### ✔ TRM — Tiny Recursive Model — Base simbólica definida
# Essenciais do sistema base
essentials = [
"CONFIG_PRINTK",
"CONFIG_TTY",
"CONFIG_SERIAL_8250",
"CONFIG_SERIAL_8250_CONSOLE",
"CONFIG_SERIAL_EARLYCON",
"CONFIG_DEVTMPFS",
"CONFIG_DEVTMPFS_MOUNT",
"CONFIG_BLK_DEV_INITRD",
"CONFIG_TMPFS",
"CONFIG_PROC_FS",
"CONFIG_SYSFS",
# EXT4 base + alias para ext2
"CONFIG_PARTITION_ADVANCED",
"CONFIG_EFI_PARTITION",
"CONFIG_MSDOS_PARTITION",
"CONFIG_EXT4_FS",
"CONFIG_EXT4_USE_FOR_EXT2",
"CONFIG_CMDLINE_PARTITION",
"CONFIG_MCORE2",
#"CONFIG_EXT4_FS_POSIX_ACL",
#"CONFIG_EXT4_FS_SECURITY",
# Console VGA (comentado para modo serial-only)
# "CONFIG_VT",
# "CONFIG_VT_CONSOLE",
# "CONFIG_VGA_CONSOLE",
# "CONFIG_FB",
# "CONFIG_FB_VESA",
# "CONFIG_FRAMEBUFFER_CONSOLE",
# "CONFIG_FONT_8x16",
# "CONFIG_FONT_8x8",
# # "CONFIG_X86_MCE",
# # "CONFIG_X86_MCE_INTEL",
# "CONFIG_X86_LOCAL_APIC",
# "CONFIG_X86_IO_APIC",
# "CONFIG_X86_MSR",
# "CONFIG_X86_FEATURE_NAMES",
# "CONFIG_X86_TSC",
# "CONFIG_X86_CMOV",
# "CONFIG_RD_GZIP",
# "CONFIG_RD_BZIP2",
# "CONFIG_RD_LZMA",
# "CONFIG_RD_XZ",
# "CONFIG_RD_LZO",
# "CONFIG_RD_LZ4",
]
O TRM é o primeiro módulo de **raciocínio interno** do Neurotron.
Ele não é uma rede neural, não aprende por SGD e não precisa de GPU.
# VirtIO (para bloco, rede, PCI)
virtio = [
"CONFIG_PCI",
"CONFIG_VIRTIO",
"CONFIG_VIRTIO_MENU",
"CONFIG_VIRTIO_PCI",
"CONFIG_VIRTIO_PCI_LEGACY",
"CONFIG_VIRTIO_BLK",
"CONFIG_VIRTIO_NET",
"CONFIG_VIRTIO_CONSOLE",
"CONFIG_VIRTIO_INPUT",
"CONFIG_VIRTIO_MMIO",
"CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES",
"CONFIG_BLK_MQ_VIRTIO",
"CONFIG_BLOCK",
"CONFIG_BLK_DEV",
"CONFIG_BLOCK_LEGACY_AUTOLOAD",
"CONFIG_EXPORTFS_BLOCK_OPS",
"CONFIG_MSDOS_PARTITION", # assegura parsing de tabela de partições
]
O TRM é:
# Debug e early printk
debug = [
"CONFIG_DEBUG_KERNEL",
"CONFIG_EARLY_PRINTK",
"CONFIG_SERIAL_8250_PNP",
"CONFIG_DEBUG_INFO_NONE", # evita symbols extras
]
> um **micro-modelo simbólico**, iterativo, recorrente, energeticamente limitado,
> capaz de gerar *pensamentos internos*, previsões, julgamentos e estados mentais.
# Garante compatibilidade máxima de CPU (para manter o kernel leve, limpo e evitar CR4 panics)
disable_extras = [
# modo serial-only
"CONFIG_VT",
"CONFIG_VT_CONSOLE",
"CONFIG_VGA_CONSOLE",
"CONFIG_FRAMEBUFFER_CONSOLE",
"CONFIG_DUMMY_CONSOLE",
"CONFIG_FB",
"CONFIG_DRM",
"CONFIG_DRM_I915",
"CONFIG_LOGO",
"CONFIG_X86_PAE",
"CONFIG_X86_5LEVEL",
"CONFIG_RANDOMIZE_BASE",
"CONFIG_RETPOLINE",
"CONFIG_SMAP",
"CONFIG_SMEP",
"CONFIG_PAGE_TABLE_ISOLATION",
# modo VGA
# Deixar estes quatro comentados. Eles são core para x86_64 + QEMU.
# "CONFIG_X86_PAE",
# "CONFIG_X86_PGE",
# "CONFIG_X86_PAT",
# "CONFIG_X86_PSE",
#
# "CONFIG_X86_PSE36",
# "CONFIG_X86_VME",
# "CONFIG_X86_PVI",
# "CONFIG_X86_PCID",
# "CONFIG_PAGE_TABLE_ISOLATION",
# "CONFIG_PARAVIRT",
# "CONFIG_PARAVIRT_CLOCK",
# "CONFIG_ARCH_RANDOM",
]
```
Ele usa:
* [x] telemetria v5
* [x] memória de eventos (Hippocampus)
* [x] sinais fisiológicos
* [-] micro-regras
* [x] micro-agentes internos
para criar uma **mente mínima**, mas viva.
#### 🟦 **TRM v1 — (implementação imediata)**
> Objetivo: gerar *vida interna mínima* e um estado cognitivo coerente.
##### 🔹 1. Micro-agentes internos
Três agentes simples, independentes, mas acoplados:
##### **🛡️ Guardião**
Responsável por proteção e homeostase.
* [-] monitora delta, aceleração, temperatura e FS
* [-] ajustes preventivos
* [x] ativa markers (`enter_stress_zone`, `fs_warning`)
* [-] reduz carga quando há risco
##### **🧭 Explorador**
Responsável por “pensamento” TRM.
* [-] gera micro previsões de tendência
* [-] avalia estabilidade
* [-] modifica tick cognitivo
* [ ] inicia refinamento simbólico
##### **📜 Arqueólogo**
Responsável por memória e histórico.
* [x] lê eventos telemétricos recentes
* [-] correlaciona com estados antigos
* [x] ativa markers (`loop_suspect`, `recovering`)
* [x] influencia valência interna
#### 🔹 2. Energia / Custo Cognitivo
Cada passo TRM consome energia.
* [x] cada passo TRM consome energia
* [-] mais telemetria = mais custo
* [ ] previsões mais profundas = custo quadrático
* [-] estado “quente” aumenta custo
* [-] estado “frio” diminui custo
* [x] Quando a energia baixa demais → TRM reduz profundidade, entra em modo “mínimo”.
#### 🔹 3. Valência Interna
Uma métrica de “bem-estar”.
* [x] estabilidade aumenta valência
* [-] picos rápidos diminuem
* [x] recovery aumenta
* [x] FS warning diminui
* [-] jitter alto diminui
Valência influencia:
* [x] intensidade TRM
* [-] prioridades
* [-] ritmo cognitivo
#### 🔹 4. Ritmos Internos (Osciladores)
Quatro ritmos independentes:
* [-] `think_rate`
* [-] `memory_sync_rate`
* [-] `telemetry_rate`
* [-] `selfcheck_rate`
Alguns podem oscilar lentamente ao longo do tempo (sinusóide leve), criando:
* [-] ciclos
* [-] fases
* [-] padrões internos
Estes ritmos ajudam a criar **estabilidade dinâmica**, essencial para emergência.
#### 🔹 5. Espaço de Estados & Atratores
##### Estados principais:
* [x] `stable`
* [x] `warm`
* [x] `hot`
* [x] `critical`
* [x] `recovery`
##### Atratores cognitivos (dinâmica de V1):
* [-] estável
* [-] quasi-estável
* [-] recuperativo
* [-] oscilatório
* [ ] pré-caótico (quando delta+aceleração divergem)
O estado atual do TRM influencia:
* [x] profundidade TRM
* [x] valência
* [-] custo cognitivo
* [-] ajustes no tick
* [x] markers enviados ao Hippocampus
```
E no GRUB:
GRUB_GFXMODE=1024x768x32
GRUB_GFXPAYLOAD_LINUX=keep

1116
src/_nfdos/init.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
# neurotron/kernel_log_agent.py
from pathlib import Path
from neurotron.logbus import logbus
class KernelLogAgent:
name = "kernel.log"
def __init__(self, cortex, max_lines=256):
self.ctx = cortex
self.max_lines = max_lines
self.buffer = [] # futuramente vai para dashboard pane
def observe(self):
# leitura "bulk" por enquanto
try:
with open("/dev/kmsg", "r", encoding="utf-8", errors="ignore") as f:
for _ in range(self.max_lines):
line = f.readline()
if not line:
break
line = line.strip()
if not line:
continue
# guarda em memória (para TUI)
self.buffer.append(line)
if len(self.buffer) > self.max_lines:
self.buffer = self.buffer[-self.max_lines:]
# opcional: envia alguns para o Hippocampus
# self.ctx.memory.remember("kernel.msg", {"line": line})
except Exception as e:
logbus.debug(f"[kernel.log] erro a ler /dev/kmsg: {e}")
def think(self):
# futuro: detectar padrões, warnings, crashes…
pass
def act(self):
# futuro: alertar o utilizador, reiniciar serviços…
pass

View File

@ -0,0 +1,42 @@
# neurotron/kernel_log_agent.py
from pathlib import Path
from neurotron.logbus import logbus
class KernelLogAgent:
name = "kernel.log"
def __init__(self, cortex, max_lines=256):
self.ctx = cortex
self.max_lines = max_lines
self.buffer = [] # futuramente vai para dashboard pane
def observe(self):
# leitura "bulk" por enquanto
try:
with open("/dev/kmsg", "r", encoding="utf-8", errors="ignore") as f:
for _ in range(self.max_lines):
line = f.readline()
if not line:
break
line = line.strip()
if not line:
continue
# guarda em memória (para TUI)
self.buffer.append(line)
if len(self.buffer) > self.max_lines:
self.buffer = self.buffer[-self.max_lines:]
# opcional: envia alguns para o Hippocampus
# self.ctx.memory.remember("kernel.msg", {"line": line})
except Exception as e:
logbus.debug(f"[kernel.log] erro a ler /dev/kmsg: {e}")
def think(self):
# futuro: detectar padrões, warnings, crashes…
pass
def act(self):
# futuro: alertar o utilizador, reiniciar serviços…
pass

View File

View File

View File

View File

View File

View File

View File

@ -14,9 +14,10 @@ console = Console()
def corrigir_kernel_headers(linux_dir, env):
"""
Corrige headers incompatíveis com C23 em vários caminhos.
Adiciona guards para typedef bool / enum { false, true }.
Ajusta headers para compatibilidade com C23, mas
FORÇA que o boot code inteiro seja compilado em GNU11.
"""
console.print("[yellow]→ Patching kernel headers for C23 compatibility...[/]")
header_candidates = [
@ -28,7 +29,7 @@ def corrigir_kernel_headers(linux_dir, env):
"arch/x86/include/asm/types.h",
]
# Antes de aplicar os patches:
# Preparar scripts e headers
safe_run(["make", "prepare"], env=env)
safe_run(["make", "scripts"], env=env)
@ -40,18 +41,19 @@ def corrigir_kernel_headers(linux_dir, env):
content = path.read_text()
patched = False
# Corrige enum false/true
if "false" in content and "__bool_true_false_are_defined" not in content:
# Guard enum false/true
if "enum {" in content and "false" in content and "__bool_true_false_are_defined" not in content:
content = content.replace(
"enum {\n false = 0,\n true = 1\n};",
"#ifndef __bool_true_false_are_defined\n"
"enum {\n false = 0,\n true = 1\n};\n"
"#define __bool_true_false_are_defined 1\n#endif"
"#define __bool_true_false_are_defined 1\n"
"#endif"
)
patched = True
# Corrige typedef _Bool
if "typedef _Bool" in content and "__STDC_VERSION__" not in content:
# typedef _Bool bool;
if "typedef _Bool" in content and "STDC_VERSION" not in content:
content = content.replace(
"typedef _Bool bool;",
"#ifndef __cplusplus\n"
@ -66,26 +68,52 @@ def corrigir_kernel_headers(linux_dir, env):
path.write_text(content)
console.print(f"[green]✔ Patched:[/] {relpath}")
# Corrige Makefile do boot
boot_makefile = linux_dir / "arch/x86/boot/Makefile"
if boot_makefile.exists():
with open(boot_makefile, "a") as f:
f.write("\n# C23 fix\nccflags-y += -std=gnu11 -Wno-error\n")
console.print("[cyan]→ Applied local Makefile override for boot code (C23 fix)[/]")
# ===========================================================
# 🔥 Parte crítica: Remover C23 do boot COMPLETO
# ===========================================================
# Corrige Makefile do boot/compressed
boot_compr_makefile = linux_dir / "arch/x86/boot/compressed/Makefile"
if boot_compr_makefile.exists():
with open(boot_compr_makefile, "a") as f:
f.write("\n# C23 fix\nccflags-y += -std=gnu11 -Wno-error\n")
console.print("[cyan]→ Applied local Makefile override for boot/compressed code (C23 fix)[/]")
# Diretórios que NUNCA podem ser compilados com C23
BOOT_CRITICAL_DIRS = [
"arch/x86/boot",
"arch/x86/boot/compressed",
"drivers/firmware/efi/libstub",
]
for d in BOOT_CRITICAL_DIRS:
mk = linux_dir / d / "Makefile"
if mk.exists():
# Remove flags C23 pré-existentes
text = mk.read_text()
text = text.replace("-std=c23", "")
text = text.replace("-std=gnu2x", "")
with open(mk, "w") as f:
f.write(text)
# Agora força GNU11 explícito
with open(mk, "a") as f:
f.write("\n# --- NFDOS C23 BOOT SANITY OVERRIDE ---\n")
f.write("ccflags-y += -std=gnu11\n")
f.write("KBUILD_CFLAGS := $(filter-out -std=c23 -std=gnu2x,$(KBUILD_CFLAGS))\n")
f.write("KBUILD_CFLAGS += -std=gnu11\n")
console.print(f"[cyan]→ Boot directory forced to GNU11:[/] {d}")
# ===========================================================
# 🔥 Garantia absoluta: remover C23 de flags globais herdadas
# ===========================================================
top_makefile = linux_dir / "Makefile"
if top_makefile.exists():
txt = top_makefile.read_text()
txt = txt.replace("-std=c23", "")
txt = txt.replace("-std=gnu2x", "")
with open(top_makefile, "w") as f:
f.write(txt)
console.print("[cyan]→ Global C23 overrides neutralized in main Makefile[/]")
console.print("[green]✔ Kernel headers & boot toolchain fully sanitized.[/]")
# Corrige Makefile do EFI stub
efi_makefile = linux_dir / "drivers/firmware/efi/libstub/Makefile"
if efi_makefile.exists():
with open(efi_makefile, "a") as f:
f.write("\n# C23 fix\nccflags-y += -std=gnu11 -Wno-error\n")
console.print("[cyan]→ Applied local Makefile override for EFI stub (C23 fix)[/]")
def corrigir_kernel_overrides(cross_compile):
env = {
@ -120,6 +148,29 @@ def corrigir_kernel_overrides(cross_compile):
"CONFIG_MCORE2",
#"CONFIG_EXT4_FS_POSIX_ACL",
#"CONFIG_EXT4_FS_SECURITY",
# Console VGA (comentado para modo serial-only)
# "CONFIG_VT",
# "CONFIG_VT_CONSOLE",
# "CONFIG_VGA_CONSOLE",
# "CONFIG_FB",
# "CONFIG_FB_VESA",
# "CONFIG_FRAMEBUFFER_CONSOLE",
# "CONFIG_FONT_8x16",
# "CONFIG_FONT_8x8",
# # "CONFIG_X86_MCE",
# # "CONFIG_X86_MCE_INTEL",
# "CONFIG_X86_LOCAL_APIC",
# "CONFIG_X86_IO_APIC",
# "CONFIG_X86_MSR",
# "CONFIG_X86_FEATURE_NAMES",
# "CONFIG_X86_TSC",
# "CONFIG_X86_CMOV",
# "CONFIG_RD_GZIP",
# "CONFIG_RD_BZIP2",
# "CONFIG_RD_LZMA",
# "CONFIG_RD_XZ",
# "CONFIG_RD_LZO",
# "CONFIG_RD_LZ4",
]
# VirtIO (para bloco, rede, PCI)
@ -151,8 +202,14 @@ def corrigir_kernel_overrides(cross_compile):
"CONFIG_DEBUG_INFO_NONE", # evita symbols extras
]
# Desativa gráficos e Garante compatibilidade máxima de CPU (para manter o kernel leve, limpo e evitar CR4 panics)
disable_graphics = [
# Garante compatibilidade máxima de CPU (para manter o kernel leve, limpo e evitar CR4 panics)
disable_extras = [
# Deixar estes quatro comentados. Eles são core para x86_64 + QEMU.
# "CONFIG_X86_PAE",
# "CONFIG_X86_PGE",
# "CONFIG_X86_PAT",
# "CONFIG_X86_PSE",
# modo serial-only
"CONFIG_VT",
"CONFIG_VT_CONSOLE",
"CONFIG_VGA_CONSOLE",
@ -169,6 +226,15 @@ def corrigir_kernel_overrides(cross_compile):
"CONFIG_SMAP",
"CONFIG_SMEP",
"CONFIG_PAGE_TABLE_ISOLATION",
# estes estao sendo testados
# "CONFIG_X86_PSE36",
# "CONFIG_X86_VME",
# "CONFIG_X86_PVI",
# "CONFIG_X86_PCID",
# "CONFIG_PAGE_TABLE_ISOLATION",
# "CONFIG_PARAVIRT",
# "CONFIG_PARAVIRT_CLOCK",
# "CONFIG_ARCH_RANDOM",
]
# Habilita todos os conjuntos
@ -184,7 +250,7 @@ def corrigir_kernel_overrides(cross_compile):
safe_run(["scripts/config", "--disable", opt], env=env)
# Desativa o que não precisamos
for opt in disable_graphics:
for opt in disable_extras:
safe_run(["scripts/config", "--disable", opt], env=env)
# Formatos binários básicos
@ -433,7 +499,7 @@ def run():
console.rule("[bold yellow]Kernel / BusyBox / Python[/bold yellow]")
console.print("1. Obter código-fonte do Kernel Linux")
console.print("2. Compilar Kernel com Toolchain NFDOS")
console.print("3. Obter e compilar BusyBox")
console.print("3. Obter e compilar BusyBox com Toolchain NFDOS")
console.print("4. Compilar Python estatico com Toolchain NFDOS")
console.print("5. Obter e compilar Bibliotecas do Neurotron")
console.print("6. Montar RootFS e gerar imagem bootável")
@ -501,6 +567,10 @@ def run():
# Passo 3 — Aplicar patches C23 aos headers
corrigir_kernel_headers(linux_dir, env)
# Passo 3.1 — Aplicar patch para filtrar o mask para só conter bits seguros.
safe_run(["git", "checkout", "--", "arch/x86/mm/init.c"], cwd=linux_dir)
safe_run(f"cp {nfdos_dir}/init.c {linux_dir}/arch/x86/mm/init.c", shell=True)
# Passo 4 — Aplicar overrides minimalistas (serial-only, sem VGA)
corrigir_kernel_overrides(cross_compile)
@ -841,13 +911,16 @@ def run():
qemu_cmd = (
f"qemu-system-x86_64 "
f"-machine q35,accel=kvm "
f"-cpu qemu64 "
f"-machine q35,accel=kvm " # q35,accel=kvm
f"-cpu qemu64 " # qemu64
f"-kernel {bz_image} "
f"-initrd {nfdos_dir}/initramfs.cpio.gz "
f"-append '{kernel_params}' "
f"-drive file={data_disk},if=virtio,format=raw "
f"-m 1024 "
# f"-vga std "
# f"-display default "
# f"-serial mon:stdio "
f"-nographic "
f"-no-reboot"
)