SchOS/NOTICE
Nexoniarz c0806d1b64 net: a TCP/IP stack, and AF_INET on the sockets that were already there
lwIP 2.2.0, fetched by ports/lwip and compiled straight into the kernel.
Not written from scratch, and the reason is not the packet formats: it is
congestion control, retransmission, window management and twenty years of
corner cases that only show up against a real peer. Not FreeBSD's
netinet either, though the licence would have allowed it -- that stack is
not a library, it reaches into mbufs, epoch(9), netisr, VNET and uma(9),
so adopting it means porting FreeBSD's kernel infrastructure first. lwIP
was written for exactly this situation: a small kernel with a raw
Ethernet driver and a port layer of a few hundred lines.

It is kernel code, so nothing is installed into the sysroot and there is
no second build system: the top-level Makefile compiles the files it
wants against our port headers. The file list is explicit rather than a
wildcard, because lwIP ships IPv6, 6LoWPAN, PPP, SLIP, DNS-SD and a dozen
apps in the same tree, and building what is not configured yields either
dead code or a link error naming a port function nobody meant to write.
Its sources are unmodified and its warnings are silenced for its files
only -- patching them would mean maintaining a fork.

The port layer is ours: a lock, a clock, the netif that hands frames to
e1000, lwipopts.h, and a shim/ directory of tiny headers so lwIP's
<string.h> and friends resolve to the kernel's functions instead of the
host's, whose prototypes disagree and would otherwise be found on the
default include path.

NO_SYS=1, so lwIP has no threads of its own and one kernel thread feeds
it. A thread rather than the interrupt handler, because a call into lwIP
can reach the driver, the driver can sleep, and an interrupt handler
cannot -- so the interrupt still only clears the cause register and the
thread polls. kthread_create is new and generally useful: a process with
a kernel-only page directory, no files, no cwd, no parent, dispatched
from forkret, which can therefore sleep and be preempted like anything
else. DHCP obtains an address at boot and the console says which one.

AF_INET went in exactly where phase 2 said it would. socknew dispatches
on the domain, kernel/net/inet.c implements the internet side on lwIP's
raw API, and not one syscall changed shape: bind, connect, listen,
accept, read and write reach the same descriptors they always did. TCP
and UDP both work. cmd/nettest opens a connection, writes, and reads the
answer back.

Two things are owed and named here so they are not discovered later:
recvfrom does not yet report the source address, and the socket paths
poll on the timer tick instead of sleeping on the socket. Both are
follow-ups, not redesigns.

NOTICE carries lwIP's BSD-3 text. Clause 3 is no-endorsement, not the
old advertising clause, so it sits with Apache-2.0 without difficulty.

Verified: the tree builds clean, and the headless boot check passes with
27 [ok] and no failures with the stack compiled in and the thread
running -- which is the part that would break first if netinit deadlocked
or the thread starved anything. An end-to-end connection test belongs in
that suite and is the next commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 16:02:48 +02:00

180 lines
9.5 KiB
Text

SchOS
Copyright 2026 Nexoniarz
This product includes software developed as part of the SchOS project,
licensed under the Apache License, Version 2.0. See LICENSE.
================================================================================
Third-party software
================================================================================
SchOS incorporates and redistributes software written by others. Their
licences apply to their code and are NOT superseded by the SchOS licence.
A built SchOS image contains binaries derived from all of the following.
--------------------------------------------------------------------------------
xv6-x86_64 / xv6 MIT License
--------------------------------------------------------------------------------
Copyright (c) 2006-2019 Frans Kaashoek, Robert Morris, Russ Cox,
Massachusetts Institute of Technology CSAIL
The SchIFT kernel is a derivative work of xv6. Substantial portions of
kernel/ -- notably the process, trap, virtual memory, buffer cache and v1
filesystem code -- descend from it, however heavily rewritten. The MIT licence
requires that this notice be preserved in all copies; see LICENSE.MIT.
--------------------------------------------------------------------------------
musl libc 1.2.5 MIT License
--------------------------------------------------------------------------------
Copyright (c) 2005-2020 Rich Felker and contributors
Built from ports/musl. Provides the C library every userland program links
against. See the extracted source's COPYRIGHT file for the full contributor
list, which the MIT terms require be carried along with binaries.
--------------------------------------------------------------------------------
toybox 0.8.12 Zero-Clause BSD (0BSD)
--------------------------------------------------------------------------------
Copyright (c) 2006-2024 Rob Landley and contributors
Built from ports/toybox. Supplies the standard command set in /bin. 0BSD
imposes no attribution requirement at all; this entry is courtesy, not
obligation.
--------------------------------------------------------------------------------
mksh R59c MirOS Licence
--------------------------------------------------------------------------------
Copyright (c) 2002-2023 Thorsten Glaser and contributors
Portions derived from the Public Domain Korn Shell (pdksh)
Built from ports/mksh. Supplies /bin/sh. The MirOS Licence is permissive and
requires the copyright notice be retained.
--------------------------------------------------------------------------------
lwIP 2.2.0 BSD 3-Clause
--------------------------------------------------------------------------------
Copyright (c) 2001, 2002 Swedish Institute of Computer Science
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Fetched by ports/lwip and compiled into the kernel -- it is the TCP/IP stack,
not a userland library, so it is present in every built kernel image rather
than in a binary under /bin. The port layer written for SchOS
(kernel/net/lwip/) is Apache-2.0 and is not part of lwIP; lwIP's own sources
are unmodified. Clause 3 is a no-endorsement term, not the four-clause
advertising requirement, so it combines with Apache-2.0 without difficulty.
--------------------------------------------------------------------------------
Intel 8254x device identifiers BSD 3-Clause
--------------------------------------------------------------------------------
Copyright (c) 2001-2020, Intel Corporation
All rights reserved.
The PCI device IDs in include/e1000.h are transcribed from FreeBSD's
sys/dev/e1000/e1000_hw.h, which carries the Intel 3-clause BSD licence above
(verified: no advertising clause). Only the identifier constants are used --
data, not implementation. kernel/drivers/net/e1000/e1000.c is written from
Intel's public manual 317453 and contains no FreeBSD or Intel driver code.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the conditions of the 3-clause BSD
licence are met, including retention of this notice and the disclaimer, and
that neither the name of Intel Corporation nor the names of its contributors
are used to endorse or promote products derived from this software without
specific prior written permission.
--------------------------------------------------------------------------------
usb.ids -- USB vendor and product database BSD 3-Clause (dual-licensed)
--------------------------------------------------------------------------------
Maintained by Stephen J. Gowdy <linux.usb.ids@gmail.com>
http://www.linux-usb.org/usb.ids
Distributed by its maintainer under the terms of *either* the GNU General
Public License version 2 or later, *or* the 3-clause BSD Licence. SchOS takes
the BSD option; the GPL option is not exercised and could not be, since
Apache-2.0 and GPL-2.0-only cannot be combined (see docs/licensing.md section
2).
Shipped verbatim as /usr/share/usb.ids. Cached in dist/ and refreshed with
`make usb-ids`, never automatically -- the version and date are in the file's
own header, so what shipped is always knowable.
--------------------------------------------------------------------------------
Roboto Apache-2.0
--------------------------------------------------------------------------------
Copyright the Roboto Project Authors (https://github.com/googlefonts/roboto)
Shipped as /usr/share/fonts/Roboto-Regular.ttf, from ports/Roboto. Licensed
under Apache-2.0 -- the same licence as SchOS itself, so it carries no
obligation beyond this notice. Intended for the desktop, window manager and
compositor.
--------------------------------------------------------------------------------
JetBrains Mono SIL OFL 1.1
--------------------------------------------------------------------------------
Copyright 2020 The JetBrains Mono Project Authors
(https://github.com/JetBrains/JetBrainsMono)
Shipped as /usr/share/fonts/JetBrainsMono-Regular.ttf, from ports/JetBrains_Mono
(full licence text at ports/JetBrains_Mono/OFL.txt). Intended for the terminal
and TTY.
Under the SIL Open Font License 1.1 the font remains under OFL even inside this
Apache-2.0 system -- that does not reach any other part of SchOS -- and it may
not be sold on its own. Bundling it with an operating system is expressly
permitted. JetBrains Mono declares no Reserved Font Name, so a modified version
(a pre-rasterised bitmap, for instance) may keep the name.
--------------------------------------------------------------------------------
"New File System For XV6" MIT License
--------------------------------------------------------------------------------
Copyright (c) Qi Ma, Leyi Pan, Ao Sun, Peiran Xu
kernel/fs/fs.c and parts of tools/mkfs.c derive from this project, which extends
xv6's file system with features SchOS still uses today:
- the HTree hashed directory index (BKDRHash, HASHRANGE, the primary/overflow
bucket layout), after Daniel Phillips, "A Directory Index for EXT2",
5th Annual Linux Showcase & Conference, 2001
- Ext4-style extents (T_EXTENT)
- the inode bitmap
- symbolic links, file permissions, lseek and append
Licensed under the MIT License, which permits this use and requires that the
copyright notice and permission notice be retained. This entry is that
retention; it was missing until 2026-08-09 and is recorded here regardless of
what happens to the code, because the obligation attaches to every copy already
made.
Distinct from xv6 itself (LICENSE.MIT), which this project in turn derives from.
================================================================================
The build downloads upstream tarballs into dist/ and applies the patches in
ports/<name>/patches/. Nothing in ports/ is SchOS code; do not add first-party
work there. See docs/layout.md.
Licence questions -- what may be copied in, what may never be, and how to check
a NetBSD file's clause before using it -- are worked through in
docs/licensing.md.