Skip to content

📋 GUIDELINES: Future Technical Debt Management - Layer Organization Best Practices #34

@ajlennon

Description

@ajlennon

📋 Future Technical Debt Management - Layer Organization Best Practices

🎯 Purpose

This issue establishes guidelines and best practices for preventing future technical debt accumulation in the Yocto layer architecture, based on the successful reorganization completed in issue #33.

🏗️ Layer Architecture Guidelines

🔧 meta-dynamicdevices (Top Layer)

Purpose: Coordination and layer management ONLY

  • NEVER add recipes directly
  • ✅ Layer configuration files (layer.conf, COPYING.MIT)
  • ✅ Documentation (README.md, release notes)
  • ✅ CI/CD configuration
  • ✅ Submodule references

🔩 meta-dynamicdevices-bsp (Hardware Layer)

Purpose: Hardware-specific components and board support

  • ✅ Machine configurations (conf/machine/)
  • ✅ Device tree files and overlays
  • ✅ Bootloader configurations
  • ✅ Hardware-specific drivers and firmware
  • ✅ GPIO control utilities
  • ✅ Hardware test utilities
  • ✅ Board-specific network configurations

📦 meta-dynamicdevices-distro (Software Layer)

Purpose: Software packages and distribution policies

  • ✅ Application recipes
  • ✅ Library packages
  • ✅ Python packages and language bindings
  • ✅ System services and daemons
  • ✅ Container and virtualization support
  • ✅ Development tools and utilities

🚨 Red Flags - When to Stop and Review

🛑 Immediate Review Required

  • Adding recipes to the top layer (meta-dynamicdevices)
  • Creating duplicate recipes across layers
  • Adding hardware-specific items to distro layer
  • Adding software packages to BSP layer
  • Creating new recipes-* directories without justification

⚠️ Caution Required

  • Large recipe additions (>5 recipes at once)
  • Cross-layer dependencies
  • Firmware files in multiple locations
  • Mixed hardware/software in single recipe

📝 Decision Framework

Step 1: Identify Recipe Type

  • Hardware-specific? → BSP layer
  • Software/application? → Distro layer
  • Coordination/config? → Top layer (rare)

Step 2: Check for Conflicts

  • Search for existing recipes: find . -name "*recipe-name*"
  • Verify no duplicate functionality
  • Check layer dependencies

Step 3: Validate Placement

  • Run yocto-check-layer validation
  • Verify builds work across machines
  • Test layer isolation

🔄 Regular Maintenance Tasks

Monthly Reviews

  • Audit for duplicate recipes
  • Check for orphaned files
  • Validate layer dependencies
  • Review recipe placement

Quarterly Cleanups

  • Remove unused recipes
  • Consolidate related functionality
  • Update documentation
  • Validate CI/CD pipelines

🛠️ Tools and Commands

Layer Validation

# Validate individual layers
yocto-check-layer meta-dynamicdevices-bsp
yocto-check-layer meta-dynamicdevices-distro

# Find duplicate recipes
find . -name "*.bb" | sort | uniq -d

# Check for empty directories
find . -type d -empty

Recipe Analysis

# Find all recipes in layer
find meta-dynamicdevices-bsp -name "*.bb" -o -name "*.bbappend"

# Check recipe dependencies
bitbake-layers show-recipes | grep recipe-name

# Validate recipe syntax
bitbake -p recipe-name

📚 Reference Architecture

✅ Good Examples

  • meta-dynamicdevices-bsp/recipes-bsp/u-boot/ - Bootloader configs
  • meta-dynamicdevices-distro/recipes-devtools/python/ - Python packages
  • meta-dynamicdevices-bsp/recipes-kernel/firmware-tas2563/ - Hardware firmware

❌ Anti-patterns to Avoid

  • Mixed hardware/software in single directory
  • Duplicate recipes across layers
  • Hardware-specific items in distro layer
  • Software packages in BSP layer

🎯 Success Metrics

Build Quality

  • Zero duplicate recipe warnings
  • Clean yocto-check-layer validation
  • No cross-layer conflicts
  • Fast, reliable builds

Maintainability

  • Clear ownership boundaries
  • Easy to locate components
  • Isolated testing possible
  • Simple dependency chains

📞 Escalation Process

When in Doubt

  1. Review this issue for guidance
  2. Check existing patterns in the layers
  3. Ask for review before committing
  4. Run validation tools before merge

Review Required For

  • New recipe directories
  • Cross-layer dependencies
  • Large recipe additions
  • Architecture changes

🔗 Related Issues


Following these guidelines will prevent technical debt accumulation and maintain the clean, professional layer architecture we've established.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions