<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/tools/netboot, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/tools/netboot?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/tools/netboot?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-17T12:11:22Z</updated>
<entry>
<title>net: DHCP client - lease the IP at boot instead of hardcoding it</title>
<updated>2026-07-17T12:11:22Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T12:11:22Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=a2cb756693229c7880d926d2cdde2f838c697415'/>
<id>urn:sha1:a2cb756693229c7880d926d2cdde2f838c697415</id>
<content type='text'>
The address is no longer baked in. net_init starts at 0.0.0.0; a DHCP client
runs as the first thing on boot (init/shell forks it and waits), and only once
it has a lease (or gives up) does the prompt appear.

Kernel:
- IP is configurable: 0.0.0.0 until leased; NET_SETIP op stores it.
- 16-bit frame length. DHCP/BOOTP packets are ~272 bytes, over the old 255-byte
  frame cap, so net_slip_send takes a 16-bit length, net_pump assembles into a
  320-byte buffer with a 16-bit wNetRxLen, and udp_send writes a 16-bit IP total.
  Payloads stay &lt;=255 (kept small on purpose) so the per-protocol datalen math
  is unchanged. wNetTx/wNetRxBuf 256-&gt;320, SK_RXBUF 208-&gt;288.

Userland:
- c/dhcp.c: DISCOVER-&gt;OFFER-&gt;REQUEST-&gt;ACK over a UDP socket, then net_setip();
  times out gracefully (shell still boots) if there's no server. sh.c runs it
  before the prompt.

Bridge (self-contained DHCP server, no dnsmasq):
- tunbridge.py + netboot intercept UDP-&gt;:67 and answer OFFER/ACK leasing
  10.0.0.2 (gateway 10.0.0.1); everything else is bridged/NATed as before.

Regression-tested ICMP/UDP/TCP after the 16-bit change. Verified end to end:
    dhcp: discovering
    dhcp: leased 10.0.0.2
    /# ping 10.0.0.1   -&gt; 4/4 (traffic from the leased address)
</content>
</entry>
<entry>
<title>net: keep network packets out of the console (fixes shell garbage on netboot)</title>
<updated>2026-07-17T11:29:42Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T11:29:42Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=e442252d72f1aab4c332a76983cd3924ce2b492b'/>
<id>urn:sha1:e442252d72f1aab4c332a76983cd3924ce2b492b</id>
<content type='text'>
The link port is both the console-input fallback and the network. At the shell
prompt the host's multicast (mDNS/LLMNR/IGMP) was fed to the serial and KGetc
read those packet bytes as console input -&gt; garbage in the shell, OSK unusable.

Two-part fix:
- KGetc now skips SLIP frames (0xC0-delimited) on the serial console path, so
  inbound packets never surface as console input. Plain injected bytes (the
  headless tunbridge command path) still pass through. New wConInSkip flag.
- netboot/tunbridge only forward IP packets destined to 10.0.0.2 (drop the
  multicast noise at the bridge).

Verified: GB sits at a clean "/#" prompt while all packets (noise included) are
forwarded; being-pinged (3/3) and wget still work. On the emulator, the OSK is
SELECT=space, START=enter, A=z, B=x, d-pad=WASD/arrows.
</content>
</entry>
<entry>
<title>tools: netboot - interactive networked emulator (TUN + NAT + --serial-sock)</title>
<updated>2026-07-17T11:22:01Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T11:22:01Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=6c1c49d676ca6fa9ab3d8cf1b80c98e45b85fbe0'/>
<id>urn:sha1:6c1c49d676ca6fa9ab3d8cf1b80c98e45b85fbe0</id>
<content type='text'>
Brings up gbtun0 (10.0.0.1/24) + NAT, then launches sl0pboy with your own args
and the link port bridged to the TUN over a unix socket (the emulator's new
--serial-sock). Unlike headless tunbridge, the LCD + on-screen keyboard stay
live, so it's a fully interactive networked Game Boy: the OSK is the console,
the link port is the network.

    sudo tools/netboot --sixel --chrome gbos.gb
    # on the GB: SELECT for the OSK, then type: wget example.com / ping 1.1.1.1

GB is 10.0.0.2, host is 10.0.0.1. Requires /dev/net/tun + root. Ctrl-C or quit
the emulator to tear down. tunbridge stays for headless scripted runs.
</content>
</entry>
</feed>
