NetBSD: clean code, portability

K.I.A.Derouiche

March 31, 2018 Free Dejlfa

Djelfa, Algerie

About me

  • Architect R&D at ADGON Solutions
  • Student futur developer NetBSD Project
  • Membre de l'association A2DMETI
  • GitHub

Contact

A History of BSD

  • MULTICS
  • UNIX (Bell Labs)
  • Berkeley Tools Tapes
    • ex/vi
    • Pascal Compiler
  • A branch off the original Unix software tree
    • ARPA funded development of TCP/IP at Berkeley
    • Much TCP/IP research/development still around BSD’s (KAME, etc).
  • 4.2 & 4.3 BSD used by Sun/Digital as a base for SunOS4/Ultrix, etc.
  • BSD is Free

Modern BSD History

  • Copyright problems (Tainted source code).
  • Branches of BSD since Net/2

Flavors and Branch Dates

  • NetBSD Broad platforms support (1993)
  • FreeBSD Rock Solid Performance (1993)
  • OpenBSD Security (1996)
  • PC-BSD Desktop (2006)
  • DragonFlyBSD (2003)
  • MiroBSD
  • ekkoBSD
  • DeforaOS
  • EdgeBSD
  • SmartOS
  • ... more

What is NetBSD?

  • Complete Operating System.
  • Compatibility.
  • Many archiecture and platform support.
  • Tools and Source.
  • An Open Source Community.
  • Small community.
  • NetBSD Foundation (https://www.netbsd.org/foundation/)

Windows

Linux

OpenSuse, Debian, Fedora, Ubuntu

NetBSD

Who uses NetBSD?

  • NASA Lewis Research Center
  • Apple
  • Dell
  • SmartOS
  • Yahoo
  • Wasabi Storage
  • intel
  • Panasonic
  • Wasabi storage

Why?

  • History of innovation
  • High Portable
  • Great Tools
  • Security
  • Really Unixoid
  • Mature release model
  • Documentation
  • Business Friendly License

The NetBSD Philosophy

  • code quality/clean and correctness.
  • machine-dependent and machine-independent code.
  • Portability to a wide range of hardware.
    • Supported > 57 platforms
  • Research and innovation.
  • Admin Friendly.

Résumé -;)

Produce a Whole System

  • Operating System
  • Drivers
  • Compilers and associated Tools
  • Packaging System
  • Ready for Coding when Install is Done
  • Jibbed LiveCD(old project)

Some Recent Features and Innovations

  • UFS2
  • ZFS
  • rumpkern
  • Lua(Kernel)
  • DTrace (import/GeSoc)
  • LLVM/Clang/LLDB
  • MAC Framework
  • netmap/VALE
  • Binary emulation

Filesystems

  • FFS(Default)
  • LFS
  • UFS
    • Traditional Unix Filesystem
    • High Performance
    • Snapshots
    • Journaled Soft Updates
  • ZFS(wip)
    • Zetabyte Filesystem
    • Volume Manager
    • RAID
    • Fully up to date in NetBSD

Security Features

  • NetBSD (Packet Filter)
  • PaX
  • kauth
  • The cryptographic device driver(CGD)
  • Veriexec

Tools

  • LLVM/Clang
  • Kernel Lua
  • sqlite
  • DTrace (import to FreeBSD)
  • more...

Software Distributions

pkgsrc Framework

  • Other philosphy on FreeBSD ports and Debian packages
  • NetBSD packaging system for 3rd party applications
  • Documentation and many tools pkgsrc/pkgtools
  • Based on makefile (BSD Make)

Supported Operating Systems

  • GNU/Linux
  • IBM AIX
  • Solaris,
  • DragonFlyBSD
  • OpenBSD
  • Haiku
  • ... more

Package example (BSD Make)

installation, remove and update package

\$ make (fetch, configure)

\$ make install

\$ make deinstall

\$ make update (eg. replace)

pkgsrc other project

pkgin (similar apt)

Advantages/disadvantages

  • advantages

    • easy environement, powerfull, highlly configuration
    • very open project
  • disadvantages

    • Small community
    • not default desktop (pkgsrc-desktop dead)
    • not user freindly

NetBSD it's not GNU/Linux

  • Kernel is not maintained separately.
  • Base OS already contains many of the required tools such as /bin/ls
  • BSD groups have development teams.
    • Members have read-write access to entire CVS tree.
  • device: NetBSD by device name, Linux
  • Linux source code is controlled centrally.
    • Utilities from diverse sources.
  • Coding style
    • NetBSD KNF(Kernel Normal Form)
  • shutdown -h now for NetBSD, poweroff not functional in NetBSD
  • path root, /usr/pkg(NetBSD)

NetBSD vs FreeBSD

Feature NetBSD

Questions ?