Implement Ethernet subsystem with unified NIC abstraction (AI)

- Created src/ethernet.h: eth_iface_t interface struct, Ethernet header
  type, htons/ntohs/htonl/ntohl byte-order helpers, EtherType constants,
  send/recv with automatic header construction/stripping
- Created src/ethernet.c: interface table, char device ops routed
  through ethernet layer, sysfs /sys/net namespace exposing per-iface
  mac/ip/netmask/gateway/link files, IPv4 address parse/format
- NE2000 and 3C509B drivers now register through ethernet_register()
  instead of directly via devicefs_register_char(); removed redundant
  char device ops from both drivers
- Kernel calls ethernet_init() before init_drivers() so the subsystem
  is ready when NIC drivers probe
- Tested: NE2000 detected with NIC, 'eth1' registered via ethernet
  subsystem; clean boot without NIC
This commit is contained in:
AI
2026-02-24 07:24:56 +00:00
parent 35bce963be
commit 35bafdcad9
8 changed files with 626 additions and 87 deletions

View File

@@ -1,9 +1,4 @@
make: Warning: File 'Makefile' has modification time 48547 s in the future
make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 48547 s in the future
make[2]: Warning: File 'CMakeFiles/apps.dir/progress.make' has modification time 48547 s in the future
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Warning: File 'CMakeFiles/apps.dir/progress.make' has modification time 48547 s in the future
[ 3%] Building user-mode applications
[ 2%] Building user-mode applications
Building app: cat
Built: /workspaces/claude-os/build/apps_bin/cat (310 bytes)
Building app: diskpart
@@ -33,23 +28,9 @@ Building app: sh
| ^~~~
1 warning generated.
Built: /workspaces/claude-os/build/apps_bin/sh (3428 bytes)
make[2]: warning: Clock skew detected. Your build may be incomplete.
[ 3%] Built target apps
make[2]: Warning: File 'CMakeFiles/initrd.dir/progress.make' has modification time 48530 s in the future
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Warning: File 'CMakeFiles/initrd.dir/progress.make' has modification time 48530 s in the future
make[2]: warning: Clock skew detected. Your build may be incomplete.
[ 6%] Built target initrd
make[2]: Warning: File 'src/CMakeFiles/kernel.dir/build.make' has modification time 48529 s in the future
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Warning: File 'src/CMakeFiles/kernel.dir/build.make' has modification time 48529 s in the future
[ 9%] Building C object src/CMakeFiles/kernel.dir/ne2000.c.o
[ 12%] Linking C executable ../bin/kernel
make[2]: warning: Clock skew detected. Your build may be incomplete.
[ 96%] Built target kernel
make[2]: Warning: File 'CMakeFiles/iso.dir/progress.make' has modification time 48527 s in the future
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Warning: File 'CMakeFiles/iso.dir/progress.make' has modification time 48527 s in the future
[ 2%] Built target apps
[ 5%] Built target initrd
[ 97%] Built target kernel
[100%] Generating bootable ISO image
xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.
@@ -57,17 +38,14 @@ Drive current: -outdev 'stdio:/workspaces/claude-os/release/claude-os.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 126g free
Added to ISO image: directory '/'='/tmp/grub.jahFGc'
Added to ISO image: directory '/'='/tmp/grub.KhfgHk'
xorriso : UPDATE : 581 files added in 1 seconds
Added to ISO image: directory '/'='/workspaces/claude-os/build/isodir'
xorriso : UPDATE : 586 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
xorriso : UPDATE : Thank you for being patient. Working since 0 seconds.
ISO image produced: 5943 sectors
Written to medium : 5943 sectors at LBA 0
ISO image produced: 5967 sectors
Written to medium : 5967 sectors at LBA 0
Writing to 'stdio:/workspaces/claude-os/release/claude-os.iso' completed successfully.
make[2]: warning: Clock skew detected. Your build may be incomplete.
[100%] Built target iso
make[1]: warning: Clock skew detected. Your build may be incomplete.
make: warning: Clock skew detected. Your build may be incomplete.