Skip to content

Add standard headers to all meniOS source files #411

@pbalduino

Description

@pbalduino

Summary

Add a standard MIT License header to all meniOS source files (excluding vendored and third-party code). This ensures proper copyright attribution and license clarity.

Background

Currently, meniOS source files lack consistent headers. Adding standard headers will:

  • Clearly identify meniOS-owned code
  • Provide copyright and license information
  • Distinguish from vendored/third-party code
  • Follow open source best practices

Standard Header Template

For C/C++ files (.c, .h, .cpp)

/*
 * meniOS - An operating system project written from scratch for fun.
 *
 * File: <filename>
 * Description: <brief description>
 *
 * Author: Plínio Balduino
 * License: MIT License
 * Copyright (c) 2020-2025 Plínio Balduino
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy 
 * of this software and associated documentation files (the "Software"), to 
 * deal in the Software without restriction, including without limitation the 
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
 * sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 */

For Assembly files (.asm, .s)

; meniOS - An operating system project written from scratch for fun.
;
; File: <filename>
; Description: <brief description>
;
; Author: Plínio Balduino
; License: MIT License
; Copyright (c) 2020-2025 Plínio Balduino
;
; [Standard MIT License text as comments...]

For Makefiles, shell scripts, Python

# meniOS - An operating system project written from scratch for fun.
#
# File: <filename>
# Description: <brief description>
#
# Author: Plínio Balduino
# License: MIT License
# Copyright (c) 2020-2025 Plínio Balduino
#
# [Standard MIT License text as comments...]

Files to Update

Include (✅ means done)

  • src/kernel/**/*.c (kernel source)
  • src/kernel/**/*.h (kernel headers)
  • include/kernel/**/*.h (public kernel headers)
  • user/libc/**/*.c (libc implementation)
  • include/libc/**/*.h (libc headers)
  • app/**/*.c (userland applications)
  • tools/**/*.sh (build scripts)
  • src/**/*.asm or .s (assembly files)
  • Root Makefile

Exclude (Vendored/Third-party)

  • vendor/ - All vendored code (TCC, binutils, Cairo, Pixman, FreeType)
  • unity/ - Unity test framework
  • Any files with existing copyright headers from other projects

Implementation Plan

Phase 1: Automated Header Generation (1-2 days)

Create a script to automatically add headers:

#!/bin/bash
# tools/add_headers.sh

TEMPLATE="header_template.txt"

for file in \$(find src app include user -name '*.c' -o -name '*.h'); do
    # Skip if already has meniOS header
    if head -3 "$file" | grep -q "meniOS"; then
        continue
    fi

    # Skip vendored code
    if echo "$file" | grep -q "vendor/"; then
        continue
    fi

    # Extract filename and guess description
    filename=\$(basename "$file")
    
    # Prepend header
    cat > "$file.tmp" <<EOF
/*
 * meniOS - An operating system project written from scratch for fun.
 *
 * File: $filename
 * Description: TODO - Add description
 *
 * Author: Plínio Balduino
 * License: MIT License
 * Copyright (c) 2020-2025 Plínio Balduino
 *
 * [Full MIT License text...]
 */

EOF
    cat "$file" >> "$file.tmp"
    mv "$file.tmp" "$file"
done

Phase 2: Manual Review (3-5 days)

  • Review each file's description
  • Replace "TODO - Add description" with actual descriptions
  • Verify no third-party code was modified
  • Test that code still compiles

Phase 3: Assembly and Script Files (1-2 days)

  • Add headers to .asm/.s files (using ;`comments)
  • Add headers to shell scripts (using # comments)
  • Add headers to Makefiles

Phase 4: Verification (1 day)

  • Ensure all meniOS files have headers
  • Ensure no vendor files were touched
  • Build and test everything
  • Commit changes

Definition of Done

  • All .c and .h files in src/, app/, include/, user/ have headers
  • All assembly files have headers
  • All build scripts have headers
  • Descriptions are accurate (not "TODO")
  • No vendored files modified
  • Full system builds successfully
  • Changes committed to git

Example

Before

#include <stdio.h>

int main() {
    printf("Hello, world!\\n");
    return 0;
}

After

/*
 * meniOS - An operating system project written from scratch for fun.
 *
 * File: hello.c
 * Description: Simple hello world program
 *
 * Author: Plínio Balduino
 * License: MIT License
 * Copyright (c) 2020-2025 Plínio Balduino
 *
 * [Full MIT License...]
 */

#include <stdio.h>

int main() {
    printf("Hello, world!\\n");
    return 0;
}

Timeline

Total: 1-2 weeks

Priority

Low-Medium - Good housekeeping, improves professionalism, but not blocking any features.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions